package com.winit.schedule.demo.taskdeal;

import javax.annotation.Resource;

import com.winit.schedule.core.model.Task;
import com.winit.schedule.core.task.ScheduleTaskDealSingle;
import com.winit.schedule.core.task.annotation.ScheduleTask;
import com.winit.schedule.demo.service.OrderService;

@ScheduleTask(taskName = "demoTaskSingle")
public class OrderTaskDealSingle implements ScheduleTaskDealSingle {

    @Resource
    private OrderService orderService;

    @SuppressWarnings("static-access")
    @Override
    public boolean execute(Task t) {

        if (null != orderService) {
            orderService.dealOrder();
        }
        try {
            Thread.currentThread().sleep(300000);
        } catch (InterruptedException e) {
            throw new RuntimeException("interruptedException");
        }
        //System.out.println("--------------------execute task: " + t.getTaskParameter() + "-----------------");
        return true;
    }

}
